﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace pygs.Messaging.Transport
{
    public class WSTransporters
    {
        private List<WSCustomTransporter> _transporters;
        protected IList<WSCustomTransporter> transporters { get { return _transporters; } }
        
        public WSTransporters()
        {
            _transporters = new List<WSCustomTransporter>();
        }

        public void RegisterTransporter(WSCustomTransporter transporter)
        {
            transporters.Add(transporter);
        }

        public WSCustomTransporter GetTransporter(Message message)
        {
            return transporters.Single(p => p.IsAcceptedFor(message));
        }
    }
}
